package tk.mybatis.springboot.service;

import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.springboot.mapper.TJoinersMapper;
import tk.mybatis.springboot.model.TJoiners;

import java.util.List;

/**
 * Created by NightDream on 2017/9/11.
 */
@Service
public class ActivityJoinerService {

    @Autowired
    private TJoinersMapper tJoinersMapper;

    public void save(TJoiners tJoiners) {
        if (tJoiners.getId() != null) {
            tJoinersMapper.updateByPrimaryKey(tJoiners);
        } else {
            tJoinersMapper.insert(tJoiners);
        }
    }

    public void deleteById(Integer id) {
        tJoinersMapper.deleteByPrimaryKey(id);
    }

    public List<TJoiners> getAll(TJoiners tJoiners) {
        return tJoinersMapper.select(tJoiners);
    }

    public TJoiners getJoiner(TJoiners TJoiners) {
        TJoiners user = tJoinersMapper.selectOne(TJoiners);
        return user;
    }
}
